
$(function() {
	var validator = $("#form_add").validate({
		rules: {
			title: "required"
		},
		messages: {
			status: {
				required: "请选择一个状态"
			}
		},
		errorPlacement: function(label, element) {
			label.insertAfter(element);
		},
		success: function(label) {
			label.html("&nbsp;").addClass("checked");
		}
	});
		
	$("#idcard").change(function(form) {		
		var body = { };
		body.idcard = $(this).val();
			
		var url = 'emp.php?do=Info.ajax_idcard';
		$.getJSON(url, body, function(json) {
			// alert($.toJSON(json));
			$("#birthday").val(json.birthday);
			$("#sex").val(json.sex);
			
			$("#province").val(json.province);
			$("#city").val(json.city);
			$("#district").val(json.region);
		});
    });
	
	$('#idcard').focus().keypress(function(event){
       if (event.keyCode == 13) {
    	   $('#nationality').focus();
       }
       
       var body = { };
		body.idcard = $(this).val();
			
		var url = 'emp.php?do=Info.ajax_idcard';
		$.getJSON(url, body, function(json) {
			// alert($.toJSON(json));
			$("#birthday").val(json.birthday);
			$("#sex").val(json.sex);
			
			$("#province").val(json.province);
			$("#city").val(json.city);
			$("#district").val(json.region);
		});
	});
	
	$('#birthday').datepicker(_date1_option);
	
	$('#indate').datepicker(_date1_option);
});